package com.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.sql.DataSource;


public class ModelDAO {

	DataSource dataSource = null;
	Connection conn=null;
	
	public void setConnection (DataSource dataSource){
		this.dataSource=dataSource;
	}
	
	/*
	 * Get the connexion to the database
	 */
	public Connection getConnection(){
		try
		{
	    Class.forName("org.postgresql.Driver");
	    
		}
		catch(Exception ex)
		{
	    System.out.println(" Erreur pilote de "+ ex.getMessage());
		}
		
		try
		{    
			// String of connexion
			conn = (Connection) DriverManager.getConnection("jdbc:postgresql://localhost:5400/postgres","postgres", "123123V");
			
		}
		catch(SQLException exc)
	   {
		    System.out.println("Erreur de connection " + exc.toString());
	   }
			 
		return conn;
	}
}
